/**
 * 
 * Web控制器路由的绑定注册相关
 * 
 */
#include "http-config.h"
#include "WebController/FileAccess/FileAccess.h"
#include "WebController/NotFound/NotFoundController.h"
std::map<std::string,HttpController*> WebRouteMapper::routeMap;
std::map<int,HttpController*> WebRouteMapper::errorRoute;
HttpController* WebRouteMapper:: defaultController;

void regRoute() {
    WebRouteMapper::setErrorController(404, new controller::NotFoundController);
    WebRouteMapper::setDefaultController(new controller::FileAccessController);
}

void defineMime() {
    MimeType::set("jpg", "image/jpeg");
    MimeType::set("jpeg", "image/jpeg");
    MimeType::set("png", "image/png");
    MimeType::set("gif", "image/gif");
    MimeType::set("ico", "image/x-icon");

    MimeType::set("html", "text/html;charset=utf-8");
    MimeType::set("htm", "text/html;charset=utf-8");

    MimeType::set("js", "application/x-javascript");
    MimeType::set("css", "text/css");

    MimeType::set("mp3", "audio/mp3");
    MimeType::set("wav", "audio/wav");
    MimeType::set("ogg", "audio/ogg");
    MimeType::set("mp4", "video/mpeg4");
}